package com.spsoft.workflow.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spsoft.core.model.Result;
import com.spsoft.workflow.entity.WfProcessLog;
import com.spsoft.workflow.mapper.WfProcessLogMapper;
import com.spsoft.workflow.model.dto.bus.BusinessProcessDto;
import com.spsoft.workflow.model.dto.bus.ProcessLogDto;
import com.spsoft.workflow.model.vo.biz.BaseUserVo;
import com.spsoft.workflow.model.vo.biz.ProcessLogVo;
import com.spsoft.workflow.service.WfProcessLogService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 流程日志;--流程日志  SEQ_WF_PROCESS_LOG 服务实现类
 * </p>
 *
 * @author dlchen
 * @since 2023-11-15
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class WfProcessLogServiceImpl extends ServiceImpl<WfProcessLogMapper, WfProcessLog> implements WfProcessLogService {


    @Override
    public BaseUserVo queryRootUser(String procInstId, String busId, String nodeId) {
        List<BaseUserVo>  list =baseMapper.queryRootUser(procInstId, busId, nodeId);
        if(list!=null && list.size()>0){
            return list.get(0);
        }
          return null;
    }

    @Override
    public Result<List<ProcessLogVo>> queryProcessLog(BusinessProcessDto bus) {
        return Result.OK(baseMapper.queryProcessLog(bus.getBusId()));
    }

}
